﻿<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="PurchaseSales.Manage" namespace="PurchaseSales.Manage.Model.Entities">
  <class name="Commodity" table="Commodity" lazy="true">
    <id name="Id" column="id" type="Guid">
      <generator class="guid.comb" />
    </id>
    <property type="string" name="Name" column="[Name]" />
    <property type="string" name="CommodityType" column="[CommodityType]" />
    <property type="string" name="Number" column="[Number]" not-null="1" unique="1"/>
    <property type="string" name="BarCode" column="[BarCode]" />
    <property type="string" name="Unit" column="[Unit]" />
    <property type="decimal" name="PresalePrice" column="[PresalePrice]" />
    <property type="double" name="Count" column="[Count]" />
    <property type="string" name="Remark" column="[Remark]" />

    <bag name="PurchaseCommodities" cascade="all">
      <key column="Commodity"/>
      <one-to-many class="PurchaseCommodity"/>
    </bag>
    <bag name="Saleses" cascade="all">
      <key column="SaleUser"/>
      <one-to-many class="Sales"/>
    </bag>
  </class>
</hibernate-mapping>